#!/sbin/openrc-run

name="SvxLink Server"
pname="svxlink"
command="/usr/bin/$pname"


POPTS="--daemon \
	${RUNASUSER:+--runasuser=$RUNASUSER} \
	${PIDFILE:+--pidfile=$PIDFILE} \
	${LOGFILE:+--logfile=$LOGFILE} \
	${CFGFILE:+--config=$CFGFILE}"

depend() {
  need localmount
  use net
  after bootmisc
}

start() {
  ebegin "Starting $pname"
  export $ENV
  start-stop-daemon --start --pidfile $PIDFILE --exec $command -- $POPTS
  eend $?
}

stop() {
  ebegin "Stopping $name"
  start-stop-daemon --stop --quiet --pidfile "$PIDFILE"
  eend $? "Failed to stop $name"
}

